package artid.com.arttogoa.parser;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 
 * 
 * 项目名称：ArtworkArtA 类名称 ：MySellInfoParser 类描述 ：我出售的详情实体类+解析（也叫商品详情） 创建人 ：耿卫斌
 * 创建时间：2016-7-22 上午10:15:35
 * 
 */
public class MySellInfoParser extends AppItem implements Serializable {
	private static final long serialVersionUID = 1L;
	private String goods_id;// 商品id
	private String goods_name;// 作品名（商品名称）
	private String realname;// 原作者（A端艺术家真实姓名）
	private String goods_price;// 价格（商品价格）
	private String gc_name;// 商品分类
	private String spec_value;// 尺寸
	private String goods_age;// 年代
	private String detail;// 艺术品简介（商品简介）
	private String code;// 证书编号
	private String by_state;// 附带证书状态
	private String goods_addtime;// 发布时间
	private String goods_commend_num;// 点赞数
	private String institutiontitle;// 机构名称
	private String goods_click;// 浏览数
	private String goods_state;// 商品上架状态 0已下架，1出售中
	private String is_auth;// 是否备案0未备案商品，1已备案商品（担保交易）
	private String gc_id;//类别ID
	private String age_id;//年代ID
	private List<MySellInfo_ImageBean> goods_image;// 图片
	/**
	 * 编辑删除图片需要的集合
	 */
	private List<String> delete_image_ids = new ArrayList<String>();// 需要删除的图片的id

	public List<String> getDelete_image_ids() {
		return delete_image_ids;
	}

	public void setDelete_image_ids(List<String> delete_image_ids) {
		this.delete_image_ids = delete_image_ids;
	}

	/**
	 * 备案出售使用
	 */
	private String goods_image1;// 完整图
	private String goods_image2;// 合影图

	@Override
	public void parse(JSONObject obj) {
		// TODO Auto-generated method stub
		if (null == obj) {
			return;
		}
		goods_id = obj.optString("goods_id");
		goods_name = obj.optString("goods_name");
		realname = obj.optString("realname");
		goods_price = obj.optString("goods_price");
		gc_name = obj.optString("gc_name");
		spec_value = obj.optString("spec_value");
		goods_age = obj.optString("goods_age");
		detail = obj.optString("detail");
		code = obj.optString("code");
		by_state = obj.optString("by_state");
		goods_addtime = obj.optString("goods_addtime");
		goods_commend_num = obj.optString("goods_commend_num");
		goods_click = obj.optString("goods_click");
		goods_state = obj.optString("goods_state");
		is_auth = obj.optString("is_auth");
		gc_id = obj.optString("gc_id");
		age_id = obj.optString("age_id");
		try {
			JSONArray jsonArray = obj.getJSONArray("goods_image");
			goods_image = new ArrayList<MySellInfo_ImageBean>();
			for (int i = 0; i < jsonArray.length(); i++) {
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				MySellInfo_ImageBean bean = new MySellInfo_ImageBean();
				bean.setGoods_image(jsonObject.optString("goods_image"));
				bean.setGoods_image_id(jsonObject.optString("goods_image_id"));
				goods_image.add(bean);
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public String getGoods_id() {
		return goods_id;
	}

	public void setGoods_id(String goods_id) {
		this.goods_id = goods_id;
	}

	public String getGoods_name() {
		return goods_name;
	}

	public void setGoods_name(String goods_name) {
		this.goods_name = goods_name;
	}

	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	public String getGoods_price() {
		return goods_price;
	}

	public void setGoods_price(String goods_price) {
		this.goods_price = goods_price;
	}

	public String getGc_name() {
		return gc_name;
	}

	public void setGc_name(String gc_name) {
		this.gc_name = gc_name;
	}

	public String getSpec_value() {
		return spec_value;
	}

	public void setSpec_value(String spec_value) {
		this.spec_value = spec_value;
	}

	public String getGoods_age() {
		return goods_age;
	}

	public void setGoods_age(String goods_age) {
		this.goods_age = goods_age;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getBy_state() {
		return by_state;
	}

	public void setBy_state(String by_state) {
		this.by_state = by_state;
	}

	public String getGoods_addtime() {
		return goods_addtime;
	}

	public void setGoods_addtime(String goods_addtime) {
		this.goods_addtime = goods_addtime;
	}

	public String getGoods_commend_num() {
		return goods_commend_num;
	}

	public void setGoods_commend_num(String goods_commend_num) {
		this.goods_commend_num = goods_commend_num;
	}

	public String getInstitutiontitle() {
		return institutiontitle;
	}

	public void setInstitutiontitle(String institutiontitle) {
		this.institutiontitle = institutiontitle;
	}

	public String getGoods_click() {
		return goods_click;
	}

	public void setGoods_click(String goods_click) {
		this.goods_click = goods_click;
	}

	public String getGoods_state() {
		return goods_state;
	}

	public void setGoods_state(String goods_state) {
		this.goods_state = goods_state;
	}

	public String getIs_auth() {
		return is_auth;
	}

	public void setIs_auth(String is_auth) {
		this.is_auth = is_auth;
	}

	public String getGc_id() {
		return gc_id;
	}

	public void setGc_id(String gc_id) {
		this.gc_id = gc_id;
	}

	public String getAge_id() {
		return age_id;
	}

	public void setAge_id(String age_id) {
		this.age_id = age_id;
	}

	public List<MySellInfo_ImageBean> getGoods_image() {
		return goods_image;
	}

	public void setGoods_image(List<MySellInfo_ImageBean> goods_image) {
		this.goods_image = goods_image;
	}

	public String getGoods_image1() {
		return goods_image1;
	}

	public void setGoods_image1(String goods_image1) {
		this.goods_image1 = goods_image1;
	}

	public String getGoods_image2() {
		return goods_image2;
	}

	public void setGoods_image2(String goods_image2) {
		this.goods_image2 = goods_image2;
	}

	public MySellInfoParser() {
		super();
	}

	public MySellInfoParser(String goods_id, String goods_name,
			String realname, String goods_price, String gc_name,
			String spec_value, String goods_age, String detail, String code,
			String by_state, String goods_addtime, String goods_commend_num,
			String institutiontitle, String goods_click, String goods_state,
			String is_auth, String gc_id, String age_id,
			List<MySellInfo_ImageBean> goods_image,
			List<String> delete_image_ids, String goods_image1,
			String goods_image2) {
		super();
		this.goods_id = goods_id;
		this.goods_name = goods_name;
		this.realname = realname;
		this.goods_price = goods_price;
		this.gc_name = gc_name;
		this.spec_value = spec_value;
		this.goods_age = goods_age;
		this.detail = detail;
		this.code = code;
		this.by_state = by_state;
		this.goods_addtime = goods_addtime;
		this.goods_commend_num = goods_commend_num;
		this.institutiontitle = institutiontitle;
		this.goods_click = goods_click;
		this.goods_state = goods_state;
		this.is_auth = is_auth;
		this.gc_id = gc_id;
		this.age_id = age_id;
		this.goods_image = goods_image;
		this.delete_image_ids = delete_image_ids;
		this.goods_image1 = goods_image1;
		this.goods_image2 = goods_image2;
	}

	@Override
	public String toString() {
		return "MySellInfoParser [goods_id=" + goods_id + ", goods_name="
				+ goods_name + ", realname=" + realname + ", goods_price="
				+ goods_price + ", gc_name=" + gc_name + ", spec_value="
				+ spec_value + ", goods_age=" + goods_age + ", detail="
				+ detail + ", code=" + code + ", by_state=" + by_state
				+ ", goods_addtime=" + goods_addtime + ", goods_commend_num="
				+ goods_commend_num + ", institutiontitle=" + institutiontitle
				+ ", goods_click=" + goods_click + ", goods_state="
				+ goods_state + ", is_auth=" + is_auth + ", gc_id=" + gc_id
				+ ", age_id=" + age_id + ", goods_image=" + goods_image
				+ ", delete_image_ids=" + delete_image_ids + ", goods_image1="
				+ goods_image1 + ", goods_image2=" + goods_image2 + "]";
	}


}
